package com.fyzk.activity.user.jczq_sp;

import android.os.Bundle;
import android.os.Message;
import android.view.View;

import com.fyzk.activity.user.RecordBaseActivity;
import com.tyjc.lottery.R;
import com.fyzk.utils.IntentParamUtils;
import com.fyzk.view.TopTitleView;

public class JCZQ_SPActivity extends RecordBaseActivity{
	
	private TopTitleView topView;
	
	private String orderId;
	private int count = 20;
	
	private JCZQSPRecordListView recordView;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.jczq_sp);
		
		orderId = getIntent().getStringExtra(IntentParamUtils.BETDETAILID);
		
		initView();
		
	}
	
	private void initView(){
		topView = (TopTitleView) findViewById(R.id.jczqsp_topview);
		topView.setCenterText("竞彩足球sp详情");
		topView.setRightVisible(View.INVISIBLE);
		topView.setOnTitleClickListener(this);
		
		recordView = (JCZQSPRecordListView) findViewById(R.id.user_jczqsp_content);
		recordView.setMoreInterface(this);
		recordView.setUpdateInterface(this);
		recordView.setRetryInterface(this);
	}

//	@Override
//	protected void request(int schemaDef) {
//		// TODO Auto-generated method stub
//		super.request(schemaDef);
//		switch (schemaDef) {
//		case SchemaDef.JCZQ_SP:
//			getJCZQSP(schemaDef);
//			break;
//
//		default:
//			break;
//		}
//	}
//
//	JCZQSPResponseData responseData;
//	@Override
//	public void onProtocalSuccess(Object paramObject) {
//		// TODO Auto-generated method stub
//		super.onProtocalSuccess(paramObject);
//		if (paramObject instanceof JCZQSPResponseData) {
//
//			responseData = (JCZQSPResponseData) paramObject;
//			int codeValue = responseData.commonResult.codeValue;
//			Log.e("codeValue", "========="+codeValue);
//			if (codeValue == 0) {
//				mHandler.sendEmptyMessage(HandlerTypeUtils.ZY_HANDLER_TYPE_LOAD_JCZQSP_SUCCESS);
//			} else {
//				mHandler.sendEmptyMessage(HandlerTypeUtils.ZY_HANDLER_TYPE_LOAD_DATA_FAIL);
//			}
//		}
//
//	}
//
//	@Override
//	public void onProtocalError(Object paramObject) {
//		// TODO Auto-generated method stub
//		super.onProtocalError(paramObject);
//	}

	@Override
	protected void parserMessage(Message msg) {
		// TODO Auto-generated method stub
		super.parserMessage(msg);
//		DJ_ProgressDialog.dissmiss();
//		switch (msg.what) {
//		case HandlerTypeUtils.ZY_HANDLER_TYPE_LOAD_JCZQSP_SUCCESS:
//			AppToast.getToast().show(responseData.commonResult.tips);
//			if (search == 1) {
//				recordView.initRecordList(responseData.ticketlist);
//			} else {
//				recordView.addRecordInfos(responseData.ticketlist);
//			}
//			break;
//		case HandlerTypeUtils.ZY_HANDLER_TYPE_LOAD_DATA_FAIL:
//			recordView.showFail();
//			try {
//				AppToast.getToast().show(responseData.commonResult.tips);
//			} catch (Exception e) {
//				// TODO: handle exception
//				AppToast.getToast().show("网络异常");
//			}
//
//			break;
//		}
//		if(isUpdate){
//			recordView.updateFinish();
//			isUpdate = false;
//		}
	}

	private void getJCZQSP(int schemaDef) {
//		ProtocalEngine engine = new ProtocalEngine(getContext());
//		JCZQSPRequestData requestData = new JCZQSPRequestData();
//		requestData.orderId = orderId;
//		requestData.count = ""+count;
//		requestData.page = ""+search;
//		engine.request(this, schemaDef, requestData);
	}
	//=======================
	
	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
		net();
	}

	@Override
	public void onLeftClick() {
		// TODO Auto-generated method stub
		finish();
	}

	@Override
	public void onCenterClick() {
		// TODO Auto-generated method stub

	}

	@Override
	public void onRightClick() {
		// TODO Auto-generated method stub

	}
	@Override
	public void onRight2Click() {
		// TODO Auto-generated method stub
		
	}

	public void net() {
		recordView.showLoading();
//		requestData(SchemaDef.JCZQ_SP);
	}

	@Override
	public void reTry() {
		// TODO Auto-generated method stub
		net();
	}

	@Override
	public void more() {
		// TODO Auto-generated method stub
		// TODO Auto-generated method stub
		search++;
		net();
	}
	
}
